/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.kreig133.spine.builder;

import com.kreig133.builder.AbstractDirector;
import com.kreig133.spine.simplemodel.SimpleSpine;
import com.kreig133.xml.XmlParser;
import java.io.File;

/**
 *
 * @author C.C.-fag
 */
public class ModelBuildDirector extends AbstractDirector<Object, SimpleSpine> {

    public ModelBuildDirector(Object parametrs) {
        super(null, parametrs);
    }

    @Override
    public SimpleSpine construct() {
        switch (type) {
            case XML:
                XmlParser modelParser = XmlParser.createXmlParser(XmlParser.MODEL);
                modelParser.parseXML((File)parametrs);
                ModelBuilder modelBuilder = new ModelBuilder();
                modelBuilder.createSpine("com.kreig133.spine.simplemodel.SimpleSpine");
                modelBuilder.createVelebra(modelParser.getParametrsForBuild());
                return (SimpleSpine) modelBuilder.getBuildedSpine();
        }
        return null;
    }
}
